import * as actionTypes from "./actionTypes";
import { fromJS } from "immutable"; //把数据转为immutable对象，使用这个使用更要使用gget方法，使用set方法去变更state内容
const defaultState = fromJS({
  active: 'home',
  footerArr: [{ title: "首页", path: "/home", selectedTab: "home", icon: 'https://zos.alipayobjects.com/rmsportal/sifuoDUQdAFKAVcFGROC.svg', selectedIcon: "https://zos.alipayobjects.com/rmsportal/iSrlOTqrKddqbOmlvUfq.svg" },
  { title: "个人中心", path: "/person", selectedTab: "person", icon: 'https://zos.alipayobjects.com/rmsportal/psUFoAMjkCcjqtUCNPxB.svg', selectedIcon: "https://zos.alipayobjects.com/rmsportal/IIRLrXXrFAhXVdhMWgUI.svg" },
  ]
});
// 导出一个纯函数
export default (state = defaultState, action) => {
  switch (action.type) {
    case actionTypes.setFooterActive:
      return state.merge(
        {
          active: fromJS(action.data)
        }
      )
    default:
      return state;
  }
};
